﻿using FluentValidation;
using Turquoise.Entities.Complex.UserModels;
using Turquoise.Globalization;

namespace Turquoise.Validation.FluentValidation.UserValidation.Rules
{
    public class UpdatePasswordRules : AbstractValidator<UpdateModel>
    {
        public UpdatePasswordRules()
        {
            RuleFor(p => p.User.OldPassword).NotEmpty().WithMessage(Resources.PasswordNotEmpty);
            RuleFor(p => p.User.Password).NotEmpty().WithMessage(Resources.PasswordNotEmpty);
            RuleFor(p => p.User.Password).Length(8, 129).WithMessage(Resources.PasswordLength);
            RuleFor(p => p.User.Password).Equal(p => p.User.ConfirmPassword).WithMessage(Resources.PasswordEqual);
        }
    }
}
